{% extends "base_content.html" %}
{% load engine_tags %}

{% block headtitle %}
   Project Information
{% endblock %}

{% block ribbon %}
    {% if user.is_authenticated %}
        <a class="ui green label" href="{% url 'project_create' %}">
            <i class="plus icon"></i>New Project
        </a>
    {% endif %}
{% endblock %}

{% block content %}

    <div id="project_view">

        {{ project.html|safe }}

        <div class="ui divider"></div>

        <div class="muted">
            {% privacy_label project %}
            Project owned by <a href="{% url 'user_profile'  project.owner.profile.uid %}">
            {{ project.owner.profile.name }}
        </a>&bull;
            {% created_by date=project.lastedit_date user=project.lastedit_user %}

        </div>

        {% if project.is_shareable and project.owner == request.user %}
            <div class="ui divider"></div>

            <div class="ui compact message"><i class="warning icon"></i>Any user with this link gains <b>Share
                Access</b> to this project.
            </div>
            <div>
                <code><a href="{% url 'project_share' project.sharable_token %}">
                    {% full_url %}{% url 'project_share' project.sharable_token %}</a>
                </code>
            </div>

        {% endif %}


        {% if write_access %}
            <div class="ui  divider"></div>

            <div class="ui basic vertical center aligned segment">

                <a class="ui  button" href="{% url 'project_edit' project.uid %}">
                    <i class="edit icon"></i>Edit project
                </a>

                <a class="ui button" href="{% url 'recipe_create' project.uid %}">
                    <i class="settings icon"></i>Create recipe
                </a>

                <a class="ui button" href="{% url 'data_upload' project.uid %}">
                    <i class="upload icon"></i>Upload Data
                </a>

                <a class="ui  button" href="{% url 'project_users' project.uid %}">
                    <i class="users icon"></i>Manage access
                </a>

                <a class="ui button tablet" href="{% url 'project_delete' project.uid %}">
                    {% if project.deleted %}
                        <i class="undo icon"></i> <span class="tablet">Restore project</span>
                    {% else %}
                        <i class="trash icon"></i> <span class="tablet">Delete project</span>
                    {% endif %}
                </a>

            </div>

        {% endif %}
    </div>
{% endblock %}
